package com.mashibing.controller;

import com.mashibing.dto.RefreshToken;
import com.mashibing.dto.ResponseResult;
import com.mashibing.service.TokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TokenController {

    @Autowired
    private TokenService tokenService;
    /**
     * 刷新token
     */
    @PostMapping("/token-refresh")
    public ResponseResult refreshToken(@RequestBody RefreshToken refreshToken){
        ResponseResult result= tokenService.refreshToken(refreshToken.getRefreshToken());
        return result;
    }

}
